package rocks.georgik.sdlapp;

import android.content.Context;
import android.graphics.PixelFormat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class VideoView extends SurfaceView {

    SurfaceHolder holder;

    public VideoView(Context context) {
        this(context,null);
    }

    public VideoView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public VideoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        holder = getHolder();
        holder.setFormat(PixelFormat.RGBA_8888);
    }

    public void playVideo(final Object surface, final String path){
        /*
        new Thread(new Runnable() {
            @Override
            public void run() {
                play(VideoView.this.getHolder().getSurface());
            }
        }).start();
        */

        Log.i("play begin", path);
        Ffmpeg.playVideo(surface, path);
    }
}
